package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.SystemMessage;
import cn.wolfcode.trip.base.mapper.SystemMessageMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.ISystemMessageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemMessageServiceImpl implements ISystemMessageService{
    @Autowired
    private SystemMessageMapper systemMessageMapper;

    @Override
    public void save(SystemMessage systemMessage) {
        systemMessageMapper.insert(systemMessage);
    }

    @Override
    public void updateBrower(Long id) {
        systemMessageMapper.updateBrower(id);

    }

    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize(),true,false,null);//禁用合理化分页
        PageHelper.orderBy(qo.getOrderBy());
        List<SystemMessage> list = systemMessageMapper.selectForList(qo);
        return new PageInfo<>(list);
    }
}
